/*
 * AopLogger.java
 *
 * Created on January 4, 2009, 8:38 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.vacuela.publishmx.util.aop;

import java.lang.reflect.Method;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.aop.AfterReturningAdvice;
import org.springframework.aop.MethodBeforeAdvice;

/**
 *
 * @author nestor.carrasco
 */
public class AopLogger implements MethodBeforeAdvice, AfterReturningAdvice {

 private static final Log logger = LogFactory.getLog(AopLogger.class);

 public void before(Method method, Object[] args, Object target) throws Throwable {
    logger.info(method.getDeclaringClass().getName()
       + "." + method.getName() + "=>Start");
 }

 public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
    logger.info(method.getDeclaringClass().getName()
       + "." + method.getName() + "=>OK");
 }
}